package com.yunshang.shoppingmall.mapper;

import com.yunshang.shoppingmall.entity.Address;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface AddressMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Address record);

    int insertSelective(Address record);

    Address selectByPrimaryKey(Integer id);
    Address selectByUserIdTwo(Integer id);
    Address selectById(Integer id);
    Address selectLogType(Integer id);
    Address selectDefault(@Param("isdefault") Integer isdefault,@Param("userId") Integer userId);
    List<Address> selectDefaultMore(@Param("isdefault") Integer isdefault,@Param("userId") Integer userId);
    int updateByPrimaryKeySelective(Address record);

    int updateByPrimaryKey(Address record);

    List<Address> selectAddressAll();

    List<Address> selectByUserId(Integer userId);
    //修改默认地址
    int updateDefaultAddress(@Param("id") int id);

    //更新某一个用户的地址只有一个为默认地址
    int updateAddressStateByUserId(@Param("userId") int userId);
    int updateAddressIsMoreAddressByUserId(@Param("userId") int userId);
}